<template>
<!--  100材料列表-->
  <div>
    <a-card :bordered="false">
      <f-search-form @searchHandler="searchHandler">
        <f-search-form-item label="项目代码" name="projectCode"/>
        <f-search-form-item label="项目名称" name="projectName"/>
      </f-search-form>
      <f-table ref="table" 
        rowKey="materialPlan100Id" 
        :columns="columns" 
        :exportBtn="false" 
        :multiple="false" 
        :params="queryParam" 
        :api="api.bmep"  
        handler="materialPlanPageListHandler">
       <span slot="projectCode" slot-scope="text, record" 
          @click="$refs.bmpplanBaseDrawer.showDrawer(record)">
            <a-tag color="#108ee9">{{record.projectCode}}</a-tag>
        </span>
        <span slot="action" slot-scope="text, record">
          <template>
            <a @click="$refs.detailsDrawer.showDrawer(record)">查看详情</a>
<!--            <a-divider type="vertical"/>-->
<!--            <a @click="$refs.drawer.showDrawer(record)">编辑</a>-->
          </template>
        </span>
      </f-table>
      <bmp-drawer ref="drawer"></bmp-drawer>
      <bmp-details-drawer ref="detailsDrawer"></bmp-details-drawer>
      <bmp-base-drawer ref="bmpplanBaseDrawer"></bmp-base-drawer>
    </a-card>
  </div>
</template>
<script>
  import bmpDrawer from './bmp_drawer.vue'
  import bmpDetailsDrawer from './bmp_details_drawer.vue'
  import bmpBaseDrawer from './bmp_base_drawer.vue'
  import api from './js/api'
  export default {
    name: 'TableList',
    components: {
      bmpDrawer,
      bmpDetailsDrawer,
      bmpBaseDrawer
    },
    data() {
      let me = this
      //操作按钮
      let operator = []
      // operator.push({
      //   name: '添加',
      //   icon: 'plus',
      //   that: this,
      //   handler: function(table, that) {
      //       that.$refs.drawer.showDrawer()
      //   }
      // })
      // operator.push({
      //   name: '删除',
      //   icon: 'delete',
      //   batch: true,
      //   handler: function(table) {
      //       table.remove()
      //   }
      // })
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: { },
        // 表头
        columns: [
          {
            title: '序号',
            width: '60',
            align: 'center',
            customRender: (text, record, index) => index + 1
          },
          {
            title: '项目代码',
            align: 'center',
            dataIndex: 'projectCode',
            scopedSlots: { customRender: 'projectCode' }
          },
          {
            title: '项目名称',
            align: 'center',
            dataIndex: 'projectName'
          },
          {
            title: '当前版本提交人',
            align: 'center',
            dataIndex: 'userName'
          },

          {
            title: '当前版本',
            align: 'center',
            dataIndex: 'ver'
          },
          {
            title: '更新时间',
            align: 'center',
            dataIndex: 'versionTime'
          },
          {
            title: '操作',
            align: 'center',
            scopedSlots: { customRender: 'action' }
          }
        ],
        operator: operator
      }
    },
    created() {
    },
    methods: {
    }
  }
</script>
